<template>
  <div class="app-container">
    <div class="searchBox">
      <el-form :inline="true" :model="search" class="demo-form-inline">
        <el-form-item label="名称：">
          <el-input v-model="search.name" name="name" placeholder="请输入内容"></el-input>
        </el-form-item>
        <el-form-item style="margin-top: -2px;">
          <el-button type="primary" @click="searchQuery">查询</el-button>
          <el-button type="info" @click="search = {};searchQuery()">重置</el-button>
        </el-form-item>
      </el-form>
    </div>

    <qm-table
      ref="qmTable"
      :data="query"
      keyProp="strategyId"
      menuType="text"
      :formOptions="{ labelWidth: '120px' }"
      :showView="false"
      :showOrder="false"
      :isCustomForm="true"
      :formValidate="formValidate"
    >
      <qm-table-column field="name" sortable="true">名称</qm-table-column>
      <qm-table-column field="code" sortable="true">编码</qm-table-column>
      <qm-table-column field="rule" sortable="true">规则</qm-table-column>
      <qm-table-column field="length" sortable="true">序号长度</qm-table-column>
      <qm-table-column field="initValue" sortable="true">序号初始值</qm-table-column>
      <qm-table-column field="step" sortable="true">序号步长</qm-table-column>

      <template v-slot:form="{ models, controlData }">
        <smart-value-strategy-create ref="create" :models="models" :controlData="controlData"></smart-value-strategy-create>
      </template>
    </qm-table>
  </div>
</template>

<script>
import Controller from "@/libs/framework/controller";
import SmartValueStrategyCreate from "./create";

export default class Instance extends Controller {
  onBeforeInit() {
    this.urls = {
      model: "/smartform/smartValueStrategy/getListModel",
      query: "/smartform/smartValueStrategy/query",
      save: "/smartform/smartValueStrategy/save",
      delete: "/smartform/smartValueStrategy/delete",
      entity: "/smartform/smartValueStrategy/getEntity",
    };
  }

  mixin() {
    return {
      components: {
        SmartValueStrategyCreate,
      },
      data() {
        return {};
      },
      methods: {
        formValidate(forms) {
          return this.$refs["create"].$refs["form1"].validate();
        },
      },
      mounted() {},
    };
  }
}
</script>

<style scoped lang="scss">
</style>

